package com.team8.search.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Document(indexName = "airplanesystem", type = "flightinfos", shards = 1, replicas = 0)
public class FlightInfoES implements Serializable{

    @Id
    private String id;

    @Field(type = FieldType.Text)
    private String ffid;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String start;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String end;

    @Field(type = FieldType.Integer)
    private Integer tickets;

    @Field(type = FieldType.Long)
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    private long startTime;

    @Field(type = FieldType.Long)
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    private long endTime;

    @Field(type = FieldType.Keyword, index = false)
    private String startSeg;

    @Field(type = FieldType.Keyword, index = false)
    private String endSeg;

    public String getStartSeg() {
        return startSeg;
    }

    public void setStartSeg(String startSeg) {
        this.startSeg = startSeg;
    }

    public String getEndSeg() {
        return endSeg;
    }

    public void setEndSeg(String endSeg) {
        this.endSeg = endSeg;
    }

    public FlightInfoES() {
    }

    public FlightInfoES(String ffid, String start, String end, Integer tickets, long startTime, long endTime, String startSeg, String endSeg) {
        this.ffid = ffid;
        this.start = start;
        this.end = end;
        this.tickets = tickets;
        this.startTime = startTime;
        this.endTime = endTime;
        this.startSeg = startSeg;
        this.endSeg = endSeg;
    }

    @Override
    public String toString() {
        return "FlightInfoES{" +
                "id='" + id + '\'' +
                ", ffid='" + ffid + '\'' +
                ", start='" + start + '\'' +
                ", end='" + end + '\'' +
                ", tickets=" + tickets +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", startSeg='" + startSeg + '\'' +
                ", endSeg='" + endSeg + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFfid() {
        return ffid;
    }

    public void setFfid(String ffid) {
        this.ffid = ffid;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
        this.start = start;
    }

    public String getEnd() {
        return end;
    }

    public void setEnd(String end) {
        this.end = end;
    }

    public Integer getTickets() {
        return tickets;
    }

    public void setTickets(Integer tickets) {
        this.tickets = tickets;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }
}
